package com.cloud.tsp.controller;

import com.cloud.api.constants.StrVo;
import com.cloud.api.domain.tsp.CommandLog;
import com.cloud.core.util.R;
import com.cloud.log.annotation.Log;
import com.cloud.log.enums.BusinessType;
import com.cloud.log.enums.OperatorType;
import com.cloud.mybatis.domain.TableDataInfo;
import com.cloud.tsp.service.ICommandLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import jakarta.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author haohaibo
 * @since 2023-12-26
 */
@RestController
@RequestMapping("/command-log")
public class CommandLogController {


    @Resource
    private ICommandLogService commandLogService;

    @Tag(name = "v1.0")
    @Operation(summary = "根据车型id查询指令日志（管理）")
    @PostMapping("/getCommandLog")
    @Log(title = "指令管理-根据车型id查询指令日志", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<CommandLog> selectCommandLog(@RequestBody @Valid StrVo para){
        TableDataInfo<CommandLog> data = commandLogService.selectCommandLog(para.getId());
        return R.ok(data.getRows());
    }
}